/**
 * 
 */
package de.gee.erep.shared.entities.citizen.details;

import de.gee.erep.shared.entities.citizen.CitizenDetail;
import de.gee.erep.shared.entities.citizen.CitizenDetailId;

public class Party implements CitizenDetail{
	/* (non-Javadoc)
	 * @see java.lang.Object#toString()
	 */
	@Override
	public String toString() {
		return "Party [id=" + id + ", president=" + president + ", name="
				+ name + ", partyId=" + partyId + "]";
	}
	/***/
	private static final long serialVersionUID = 1L;
	public static final String[] fieldnames = {"president","name","id"};
	CitizenDetailId id;
	boolean president;
	String name;
	int partyId;
	public Party(){}
	public Party(CitizenDetailId id, boolean president, String name, int partyId) {
		this.id = id;
		this.president = president;
		this.name = name;
		this.partyId = partyId;
	}
	/**
	 * @param field
	 * @param data
	 */
	public void set(String field, String data) {
		if(field.equals("president")){
			president = data==""?false:Boolean.valueOf(data);
		} else if(field.equals("name")){
			name = data;
		} else{
			partyId = Integer.valueOf(data);
		}
	}
	/* (non-Javadoc)
	 * @see de.gee.erep.shared.entities.citizen.CitizenDetail#getId()
	 */
	@Override
	public CitizenDetailId getId() {
		return id;
	}
	/**
	 * @param detailId
	 */
	public void setId(CitizenDetailId detailId) {
		this.id = detailId;
	}
}